import pyttsx3


def robot_speak(text):
    # 初始化引擎
    engine = pyttsx3.init()

    # 设置语速 (可选)
    rate = engine.getProperty('rate')
    engine.setProperty('rate', 150)

    # 设置音量 (可选)
    volume = engine.getProperty('volume')
    engine.setProperty('volume', 1.0)

    # 朗读
    engine.say(text)
    engine.runAndWait()


if __name__ == "__main__":
    robot_speak("你好，我是机器人，正在初始化系统。")